<?php

namespace App\Http\Middleware;

use Closure;

class CheckUserStatus
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $user = \Auth::user();
        if (empty($user->status)) {
            return  response()->json(['flag' => false, 'msg' => '用户已禁用'], 401);
        }
        return $next($request);
    }
}
